package org.example;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;

/**
 * Hello world!
 *
 */
public class App {
    public  interface Movable{
        void move(String ss , Map<String,Object> para);
    }
    public static class Car implements Movable{
        @Override
        public void move(String ss, Map<String, Object> para) {
            System.out.println("ss: " + ss + " , para: " + para);
        }
    }
    public static void main( String[] args ) {
        Car car = new Car();
        Movable o = (Movable)Proxy.newProxyInstance(App.class.getClassLoader()
                , new Class[]{Movable.class}
                , new InvocationHandler() {
                    @Override
                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        method.invoke(car, args);
                        return null;
                    }
                }
        );
        o.move("aa" , new HashMap<>());
    }
}
